<?php
function render_item_truyen($data,$type){
	
	if($_SESSION['mobile']!=0){
		render_item_truyen_mobi2($data,$type);
	}else
	if($data){?>
     <div class="panel panel-success my-panel">
 		  		<div class="panel-body">
    <?php
	$num=count($data);
	$rows=ceil($num/4);
		for($i=0;$i<$rows;$i++){
				$j=$i*4;
				$dt=array_slice($data,$j,4);
				
				?>
                
                <div class="row">
                		<?php
						foreach($dt as $row){
						
							?>
							
                            <div class="col-md-3 col-sm-3 col-xs-6">
                    	<div class="item_truyen_box">
                        	
                                <div class="img">
                               <?php if($row['pick']==1){?>  <div class="ribbon ribbon_hot"></div><?php }?>
                                 <?php if($row['time_upload']!=''){  
										 $ngay=date('Y-m-d h:i:s', strtotime("-2 week")); 
										 if($row['time_upload']>$ngay){ echo ' <div class="ribbon ribbon_new"></div>';}
										
								}?>
                            
                                	<a href="<?php echo url_truyen($row['id'],$row['alias']) ?>"><img class="lazy img-responsive" data-original="<?php echo TRUYEN_IMAGE_LOCAL.$row['hinhanh']?>"  /></a>
                                </div>
                                <div class="wrap_bottom_item">
                                <div class="chuong_info"><?php // echo $row['sochuong']?>/<?php echo $row['tongsochuong']?></div>
                                <div class="title"><a href="<?php echo url_truyen($row['id'],$row['alias']) ?>"><?php echo $row['ten']; ?></a></div>
                                <div class="chuong_name">
                                <?php if($row['tinhtrang']!=1){ ?>
                                <a href="<?php echo $row['chuongmoinhat_url']?>"><?php echo short_str($row['chuongmoinhat'],25)?></a>
                                <?php }else{ echo $row['tinhtrang-text']."&nbsp;&nbsp;".$row['sochuong'].' Chương'; }?>
                            
                                </div>
                               
                                <div class="stat_info">
                                	<?php if($type==1){?>
                                	<span class="pull-left author"><i class="fa fa-user"></i> <?php echo $row['tacgia']?></span>
                                	
                                    <span class="pull-left time"><?php echo time_ago($row['time_upload']) ?></span>
                                   <div class="clearfix"></div>
                                    <div class="tags"><i class="fa fa-tags"></i> <?php echo $row['theloai2']['2'];?> </div>
                                	
                                    
                                    <?php }else{ ?>
                                    <span class="pull-left author"><i class="fa fa-user"></i> <?php echo $row['tacgia']?></span>
                                
                                    <span class="pull-left time"><?php echo time_ago($row['time_update']) ?></span>
                                    <span class="pull-left tags"><i class="fa fa-tags"></i> <a href=""><?php echo $row['theloai_ten']?></a></span>
                                    
                                	<div class="clearfix"></div>
                                    <?php } ?>
                                </div>
                               </div>
                        </div><!-- End item_truyen_box -->
                    </div> <!-- End of col-md-3 -->
					
					<?php	}
						?>
                </div>
                <?php
		
		}
?>
	</div> <!-- End of panel body -->
		</div> <!-- End of panel -->
<?php
	}else{
		echo "<h1 class='text-center'>Chưa có dữ liệu</h1>";
	}
} //End render item tryen ---


function render_item_truyen_mobi2($data,$type){

	if($data){
			
	
				
				?>
			
                <ul class="list-group truyen_mobi_list">
                		<?php
						$i=1;
						foreach($data as $row){
							$j=$i%2;
							?>
							
                          
                      <li class="list-group-item mobi_item mobi_item<?php echo $j;?>">
                        		
                            
                                	<a href="<?php echo url_truyen($row['id'],$row['alias']) ?>">
                                    <div class="img pull-left">
                                   
                                    <img class="lazy img-responsive" src="<?php  echo HOME ?>public/images/loading11.gif" data-original="<?php echo TRUYEN_IMAGE_LOCAL.$row['hinhanh']?>"  />
                                    </div></a>
                      			
                              <div style="display:table-cell">
                                <div class="title"><a href="<?php echo url_truyen($row['id'],$row['alias']) ?>"><?php echo $row['ten']; ?>
                                	  <?php if($row['pick']==1){?>  <span class="label label-danger">HOT</span><?php }?>
                                	 <?php if($row['time_upload']!=''){  
										 $ngay=date('Y-m-d h:i:s', strtotime("-2 week")); 
										 if($row['time_upload']>$ngay){ echo '  <span class="label label-info">NEW</span>';}
										
									}?>
                                
                                </a></div>
                                <div style="height:3px"></div>
                                <div class="chuong_name">
                                <?php if($row['tinhtrang']!=1){ ?>
                                <a href="<?php echo $row['chuongmoinhat_url']?>"><?php echo short_str($row['chuongmoinhat'],25)?></a>
                                <?php }else{ echo "Hoàn Thành  -  ".$row['sochuong']." chương"; }?>
                            
                                </div>
                                <div>
                                     <span class="chuong_name">
                                     <?php echo "<span style='color:#3498db;font-size:12px'>".$row['tacgia']."</span>"; ?>
                                     </span>
                                    &nbsp; &nbsp;
                                      <span class="tags"><i class="fa fa-tags"></i> <?php echo $row['theloai2']['2'];?> </span>
                                </div>
                                <div class="stat_info">
                                	<div class="show-truyen-rating" style="margin: 0px;" data-average="<?= $row['rate_average']; ?>"></div>
                                     <span style="color:#999; font-size:12px"><?php echo $row['views']; ?> Views </span>   &nbsp; &nbsp; <?php echo time_ago($row['time_update']); ?>
                            
                                </div>
                                </div>
                              
                              
                            <div class="clearfix"></div>
                        </li><!-- End item_li -->
                   
					
					<?php	
					$i++;
					}
						?>
               </ul>
                <?php
		
		
?>

<?php
	}else{
		echo "<h1 class='text-center'>Chưa có dữ liệu</h1>";
	}
} //End render item tryen ---
function render_item_truyen_mobi3($data,$type){

	if($data){
			
	
				
				?>

                <div class="truyen_mobi_list">
                		<?php
						$i=1;
						foreach($data as $row){
							$j=$i%2;
							?>
							
                          
                      <div class="mobi_item mobi_item<?php echo $j;?>">
                        		
                            
                                	<a href="<?php echo url_truyen($row['id'],$row['alias']) ?>">
                                    <div class="img pull-left">
                                    <img class="lazy img-responsive" src="<?php  echo HOME ?>public/images/loading11.gif" data-original="<?php echo TRUYEN_IMAGE_LOCAL.$row['hinhanh']?>"  />
                                    </div></a>
                      
                                <div class="title"><a href="<?php echo url_truyen($row['id'],$row['alias']) ?>"><?php echo $row['ten']; ?></a></div>
                                <div class="chuong_name">
                                <?php if($row['tinhtrang']!=1){ ?>
                                <a href="<?php echo $row['chuongmoinhat_url']?>"><?php echo short_str($row['chuongmoinhat'],25)?></a>
                                <?php }else{ echo $row['tinhtrang-text']; }?>
                            
                                </div>
                               
                                <div class="stat_info">
                                	<div class="show-truyen-rating" style="margin: 0px;" data-average="<?= $row['rate_average']; ?>"></div>
                                	<?php if($type==1){?>
                                     <div class="tags"><i class="fa fa-tags"></i> <?php echo $row['theloai2']['2'];?> </div>
                              <?php } ?>
                                </div>
                            <div class="clearfix"></div>
                        </div><!-- End item_li -->
                   
					
					<?php	
					$i++;
					}
						?>
               </div>
                <?php
		
		
?>

<?php
	}else{
		echo "<h1 class='text-center'>Chưa có dữ liệu</h1>";
	}
} //End render item tryen ---
function render_item_truyen2($data,$type){
	if($data){
	$num=count($data);
	$rows=ceil($num/4);
		 $str='';
		for($i=0;$i<$rows;$i++){
				$j=$i*4;
				$dt=array_slice($data,$j,4);
				
				
             	   $str.="<div class='row'>";
                		
						foreach($dt as $row){
						
							
							
                            $str.="<div class='col-md-3 col-sm-3 col-xs-6'>";
                    	  $str.="<div class='item_truyen_box'>";
                         $str.="<div class='img'>";
                          $str.="<img src='".TRUYEN_IMAGE_LOCAL.$row['hinhanh']."'  class='img-responsive' />";
                          $str.="    </div>";
                          $str .='<div class="wrap_bottom_item">';
                                $str.=" <div class='chuong_info'>".$row['sochuong']."/".$row['tongsochuong']."</div>";
                                $str.="<div class='title'><a href='".url_truyen($row['id'],$row['alias'])."'>".$row['ten']."</a></div>";
                               $str.="<div class='chuong_name'><a href='".$row['chuongmoinhat_url']."'>".$row['chuongmoinhat']."</a></div>";
                               
                                $str.="<div class='stat_info'>";
                                	 if($type==1){
                                	$str.="<span class='pull-left author'><i class='fa fa-user'></i>".$row['tacgia']."</span>";
                                	$str.="<span class='pull-left time'>".time_ago($row['time_upload'])."</span><Br/>";
                                    
                                  $str.="<span class='tags'><i class='fa fa-tags'></i>".$row['theloai2']['2']."</span>";
                                	 $str.="<div class='clearfix'></div>";
                                    
                                     }else{ 
                                   $str.="<span class='pull-left author'><i class='fa fa-user'></i>".$row['tacgia']."</span>";
                                	$str.="<span class='pull-left time'>".time_ago($row['time_update'])."</span><Br/>";
                                    
                                    $str.="<span class='tags'><i class='fa fa-tags'></i> ".$row['theloai2']['2']."</span>";
                                	 $str.="<div class='clearfix'></div>";
                                    } 
                                $str.="</div>";
                            $str .='</div>';
                       $str.=" </div><!-- End item_truyen_box -->";
                   $str.= "</div> <!-- End of col-md-3 -->";
					
						}
						
               $str.= " </div>";
               
		
		}
		return $str;

	}else{
		$str="";
		return $str;
	}
} //End render item tryen ---
 function truyen_render_right_comment()
 {
	 ?>
      <div class="panel panel-warning ">
 		 <div class="panel-heading">
         		<ul class="mn_nav">
                <li><span class="head">Mới Thảo Luận</span></li>
            
                             
            </ul>
            <div class="clearfix"></div>
         </div>
            <div class="panel-body box_news">
     <?php
 	 $str=cache_get_truyen_comment();
	 echo $str;
	 ?>
       </div>
        </div>
     <?php
 }	

function render_item_video_home($data){

	if($data){
	$num=count($data);
	$rows=ceil($num/3);
		for($i=0;$i<$rows;$i++){
				$j=$i*3;
				$dt=array_slice($data,$j,3);
				?>
                <div class="row">
                		<?php
						foreach($dt as $row){?>
							
                                           <div class="col-md-4" id="home_video_box">
                                        <div class="item_video_box">
                                           
                                            <div class="wrap_bottom_item">
                                            <div class="title"><a href="<?php echo url_post($row['pid'],$row['alias'],'video'); ?>"><?php echo $row['title']; ?></a> </div>
                                            <div class="img" style="float:left"><a href="<?php echo url_post($row['pid'],$row['alias'],'video'); ?>"><img class="lazy img-responsive" data-original="<?php echo $row['image']; ?>" /></a></div> 
                                             
                                            <div class="stat_info">
                                            <div class="author" style="margin-bottom: 3px;"><a href="<?php echo url_video_user($row['username']); ?>"><?php echo $row['username']; ?></a></div>
                                             <div class="tags" ><i class="fa fa-tags"></i><?php echo $row['category']; ?></div>
                                                    <span class="view"><?php echo $row['views']; ?> lượt xem</span> <br />
                                                    <span class="time">
													<?php echo time_ago($row['date_created']); ?>
                                                    </span>
                                                        <div class="clearfix"></div>
                                            </div>
                                            </div>
                                        </div> <!-- End of video item box -->
                                        </div> <!-- End of col-md-3 -->
					
					<?php	}
						?>
                </div>
                <?php
		
		}
?>

<?php
	}else{
		echo "<h1 class='text-center'>Chưa có dữ liệu</h1>";
	}
} //End video render

function render_item_video($data){

	if($data){
		$num=count($data);
		$rows=ceil($num/3);
		for($i=0;$i<$rows;$i++){
			$j=$i*3;
			$dt=array_slice($data,$j,3);
			?>
                <div class="row">
                		<?php
						foreach($dt as $row){?>
							
                                           <div class="col-md-4">
                                        <div class="item_video_box">
                                            <div class="img"><a href="<?php echo url_post($row['pid'],$row['alias'],'video'); ?>"><img class="lazy img-responsive" data-original="<?php echo $row['image']; ?>" style="margin:auto" /></a></div>
                                            <div class="wrap_bottom_item">
                                            <div class="title"><a href="<?php echo url_post($row['pid'],$row['alias'],'video'); ?>"><?php echo $row['title']; ?></a> </div>
                                            <div class="author pull-left"><a href="<?php echo url_video_user($row['username']); ?>"><?php echo $row['username']; ?></a></div>
                                             <div class="tags pull-right"><i class="fa fa-tags"></i><?php echo $row['category']; ?></div>
                                             <div class="clearfix"></div>
                                            <div class="stat_info">
                                                    <span class="view"><?php echo $row['views']; ?> lượt xem</span> <span class="time pull-right">
													<?php echo time_ago($row['date_created']); ?>
                                                    </span>
                                                        <div class="clearfix"></div>
                                            </div>
                                            </div>
                                        </div> <!-- End of video item box -->
                                        </div> <!-- End of col-md-3 -->
					
					<?php	}
						?>
                </div>
                <?php
		
		}
?>

<?php
	}else{
		echo "<h1 class='text-center'>Chưa có dữ liệu</h1>";
	}
} //End video render

function render_item_video2($data){
	if($data){
		$num=count($data);
		$rows=ceil($num/3);
		for($i=0;$i<$rows;$i++){
			$j=$i*3;
			$dt=array_slice($data,$j,3);
			
                $str = '<div class="row">';
                		
						foreach($dt as $row){
							
                                           $str .= '<div class="col-md-4">';
                                        $str .= '<div class="item_video_box">';
                                            $str .= '<div class="img"><a href="'.url_post($row['pid'],$row['alias'],'video').'"><img src="'.$row['image'].'" class="img-responsive" /></a></div>';
                                            $str .= '<div class="wrap_bottom_item">';
                                            $str .= '<div class="title"><a href="'.url_post($row['pid'],$row['alias'],'video').'">'.$row['title'].'</a> </div>';
                                            $str .= '<div class="author pull-left"><a href="'.url_video_user($row['username']).'">'.$row['username'].'</a></div>';
                                             $str .= '<div class="tags pull-right"><i class="fa fa-tags"></i>'.$row['category'].'</div>';
                                             $str .= '<div class="clearfix"></div>';
                                            $str .= '<div class="stat_info">';
                                                    $str .= '<span class="view">'.$row['views'].' lượt xem</span> <span class="time pull-right">';
													 $str .= time_ago($row['date_created']);
                                                    $str .= '</span>
                                                        <div class="clearfix"></div>
                                            </div>
                                            </div>
                                        </div> <!-- End of video item box -->
                                        </div> <!-- End of col-md-3 -->';
					
						}
						
                $str .= '</div>';
              
		
		}
?>

<?php
	}else{
		$str = "<h1 class='text-center'>Chưa có dữ liệu</h1>";
	}
	return $str;
} //End video render

function render_item_blog_home($data){
	if($data){
		$num=count($data);
		$items=ceil($num/3);
		for($i=0;$i<3;$i++){
			if($i==0){
	$dt=array_slice($data,0,$items);
}else{
	$dt=array_slice($data,$i*2,2);
}
			?>
                <div class="col-md-4 home_blog_box">
                		<?php
						foreach($dt as $row){?>
					<div class="item_blog_box" >
				  <div class="title"><a href="<?php echo url_post($row['pid'],$row['alias'],'blog'); ?>"><?php echo $row['title']; ?></a></div>
                   
                   <div class="clearfix"></div>
      <div class="img"><a href="<?php echo url_post($row['pid'],$row['alias'],'blog'); ?>"><img class="lazy img-responsive" data-original="<?php echo $row['image']; ?>" /></a></div>
       <div class="stat_info">
                    	<span class="author pull-left"><a href="<?php echo url_blog_user($row['username']); ?>"><i class="fa fa-user"></i> <?php echo $row['username']; ?></a></span>
                        
                        <span class="view pull-right"><?php echo $row['views']; ?> lượt xem</span>
                        
                        <div class="clearfix"></div>
                   </div>
      <div class="noidung">
  	    <?php echo cutstring($row['sdes'],120); ?>
  	    
         </div>
     <p class="textmore pull-right"><a href="<?php echo url_post($row['pid'],$row['alias'],'blog'); ?>"><span class="label panel-label-small-title">Xem Thêm &rarr;</span></a></p>
            <div class="clearfix"></div>
            </div><!-- End of itemblogbox -->
					
					<?php	}
						?>
                </div>
                <?php
		
		}
?>

<?php
	}else{
		echo "<h1 class='text-center'>Chưa có dữ liệu</h1>";
	}
} // End render blog item

function render_item_blog($data){
	if($data){
	$num=count($data);
	$items=ceil($num/2);
		for($i=0;$i<2;$i++){
				if($i==0){
				$dt=array_slice($data,0,$items);
				}else{
				$dt=array_slice($data,$items,($num-$items));
				}
				?>
                <div class="col-md-6">
                		<?php
						foreach($dt as $row){?>
					<div class="item_blog_box">
				  <div class="title"><a href="<?php echo url_post($row['pid'],$row['alias'],'blog'); ?>"><?php echo $row['title']; ?></a></div>
                    <div class="stat_info">
                    	<span class="author pull-left"><a href="<?php echo url_blog_user($row['username']); ?>"><i class="fa fa-user"></i> <?php echo $row['username']; ?></a></span>
                        <span class="category pull-left"><i class="fa fa-tags"></i><?php echo $row['category']; ?></span>
                        <span class="view pull-left"><?php echo $row['views']; ?> lượt xem</span>
                        <span class="time pull-left"> <?php echo $row['date_created']; ?></span>
                        
                   </div>
                   <div class="clearfix"></div>
      <div class="img"><a href="<?php echo url_post($row['pid'],$row['alias'],'blog'); ?>"><img class="lazy img-responsive" data-original="<?php echo $row['image']; ?>" /></a></div>
      <div class="noidung">
  	    <?php echo $row['sdes']; ?>
         </div>
     <p class="textmore pull-right"><a href="<?php echo url_post($row['pid'],$row['alias'],'blog'); ?>"><span class="label panel-label-small-title">Xem Thêm &rarr;</span></a></p>
            <div class="clearfix"></div>
            </div><!-- End of itemblogbox -->
					
					<?php	}
						?>
                </div>
                <?php
		
		}
?>

<?php
	}else{
		echo "<h1 class='text-center'>Chưa có dữ liệu</h1>";
	}
} // End render blog item

// RENDER VIDEO RIGHT -------------------------------------
 function video_render_right_theloai()
 {
	 ?>
      <div class="panel panel-info  my-panel right-panel">
 		 <div class="panel-heading">
         		<ul class="mn_nav">
            	<li><span class="head">CATEGORY</span></li>
                             
            </ul>
            <div class="clearfix"></div>
         </div>
            <div class="panel-body blog_box" style="margin:0px; padding:0px">
     <?php
 	 $str=get_list_category_video();
	 echo $str;
	 ?>
       </div>
        </div>
     <?php
 }
		
		



 function video_render_right_comment()
 {
	 ?>
      <div class="panel panel-warning ">
 		 <div class="panel-heading">
         		<ul class="mn_nav">
                <li><span class="head">Mới Thảo Luận</span></li>
            
                             
            </ul>
            <div class="clearfix"></div>
         </div>
            <div class="panel-body box_news">
     <?php
 	 $str=cache_get_video_comment();
	 echo $str;
	 ?>
       </div>
        </div>
     <?php
 }		
// END OF RENDER VIDEO RIGHT ------------------------------


// Blog render right --------
 function blog_render_right_theloai()
 {
	 ?>
      <div class="panel panel-info  my-panel right-panel">
 		 <div class="panel-heading">
         		<ul class="mn_nav">
            	<li><span class="head">Danh Mục</span></li>
                             
            </ul>
            <div class="clearfix"></div>
         </div>
            <div class="panel-body blog_box" style="padding:0px; margin:0px">
     <?php
 	 $str=get_list_category_blog();
	 echo $str;
	 ?>
       </div>
        </div>
     <?php
 }

 function blog_render_right_comment()
 {
	 ?>
      <div class="panel panel-warning ">
 		 <div class="panel-heading">
         		<ul class="mn_nav">
                <li><span class="head">Mới Thảo Luận</span></li>
            
                             
            </ul>
            <div class="clearfix"></div>
         </div>
            <div class="panel-body box_news">
     <?php
 	 $str=cache_get_blog_comment();
	 echo $str;
	 ?>
       </div>
        </div>
     <?php
 }		
 
function truyen_render_theloai()
 {
	 ?>
     <a name="category"></a>
      <div class="panel panel-info my-panel right-panel" id="">
 		 <div class="panel-heading">
         		<ul class="mn_nav">
                <li><span class="head">Kho Truyện</span></li>
            	
                             
            </ul>
            <div class="clearfix"></div>
         </div>
            <div class="panel-body box_news">
     <?php
 	 $str=get_list_theloai_truyen();
	 echo $str;
	 ?>
       </div>
        </div>
     <?php
 }
 function truyen_render_theloai_mobi()
 {	 ?>
<div style="background-color:#fff; text-align:center">	
     <?php
 	 $str=get_list_theloai_truyen_mobi();
	 echo $str;
	 ?>
     </div>
  
   <?php
 }
 
 
 function render_pick($id=''){
 ?>
  <div class="panel panel-info my-panel right-panel" id="<?php echo $id ?>">
 		 <div class="panel-heading">
    
            <ul class="nav nav-tabs mn_tab pull-left">
         		<li><span class="head">Nổi Bật</span></li>	
          	</ul>
            	
        <ul class="nav nav-tabs mn_tab pull-right" id="tab_pick">
        	
          <li class="active li-list-cat-small"><a href="#pick_video"><span class="label panel-label-small-title">Video</span></a></li>
         <li class="li-list-cat-small"><a href="#pick_blog"><span class="label panel-label-small-title">Blog</span></a></li>
        </ul>
        <div class="clearfix"></div>
            
         </div>
  		<div class="panel-body box_news">
  	
       
        <div class="tab-content mn_tab_content pick_post">
            <div class="tab-pane active" id="pick_video">
		 <?php   	echo cache_get_video_pick(); 	 ?> 
            </div> <!-- End tab 1 -->
          <div class="tab-pane" id="pick_blog">
          <?php   	echo cache_get_blog_pick(); 	 ?> 
			</div>
         
	</div><!-- End tab content -->
    	
  		</div> <!-- End of body panel -->
		</div> <!-- End of panel-->
                <script>
$('#tab_pick a').click(function (e) {
  e.preventDefault();
  $(this).tab('show');
})
</script>
 <?php
 }
 
 
 function blog_render_view($id=''){?>
	  <div class="panel panel-info my-panel right-panel" id="<?php echo $id ?>">
 		 <div class="panel-heading">
    
            <ul class="nav nav-tabs mn_tab pull-left">
            <li><span class="head">Blog Xem Nhiều</span></li>
			</ul>
             <ul class="nav nav-tabs mn_tab pull-right" id="tab_blog_view">
             <li class="active li-list-cat-small"><a href="#ngay_blog"><span class="label panel-label-small-title">Ngày</span></a></li>
          <li class="li-list-cat-small"><a href="#tuan_blog"><span class="label panel-label-small-title">Tuần</span></a></li>
          <li class="li-list-cat-small"><a href="#thang_blog"><span class="label panel-label-small-title">Tháng</span></a></li>
         </ul>
        <div class="clearfix"></div>
         </div>
  		<div class="panel-body box_news">
  		
        
        <div class="tab-content mn_tab_content blog_view">
            <div class="tab-pane active" id="ngay_blog">
		 <?php   	echo cache_get_blog_view_day(); 	 ?> 
            </div> <!-- End tab 1 -->
          <div class="tab-pane" id="tuan_blog">
          <?php   	echo cache_get_blog_view_week(); 	 ?> 
			</div>
          <div class="tab-pane" id="thang_blog">
           <?php   	echo cache_get_blog_view(); 	 ?> 
			</div>
		</div><!-- End tab content -->
	
    	</div> <!-- End of body panel -->
		</div> <!-- End of panel-->
                        <script>
$('#tab_blog_view a').click(function (e) {
  e.preventDefault();
  $(this).tab('show');
})
</script>
        <?php
 }
 
  function video_render_view($id=''){?>
	  <div class="panel panel-info my-panel right-panel" id="<?php echo $id ?>">
 		 <div class="panel-heading">
         	<ul class="nav nav-tabs mn_tab pull-left" id="tab-video-view">
            	<li><span class="head">Video Xem Nhiều</span></li>
            	</ul>
            <ul class="nav nav-tabs mn_tab pull-right" id="tab_video_view">
            	<li class="active li-list-cat-small"><a href="#ngay_video"><span class="label panel-label-small-title">Ngày</span></a></li>
          		<li class="li-list-cat-small"><a href="#tuan_video"><span class="label panel-label-small-title">Tuần</span></a></li>
          		<li class="li-list-cat-small"><a href="#thang_video"><span class="label panel-label-small-title">Tháng</span></a></li>
			</ul>
            <div class="clearfix"></div>
         </div>
  		<div class="panel-body box_news">
  		
        <div class="tab-content mn_tab_content video_view">
            <div class="tab-pane active" id="ngay_video">
		 <?php   	echo cache_get_video_view_day(); 	 ?> 
            </div> <!-- End tab 1 -->
          <div class="tab-pane" id="tuan_video">
          <?php   	echo cache_get_video_view_week(); 	 ?> 
			</div>
          <div class="tab-pane" id="thang_video">
           <?php   	echo cache_get_video_view(); 	 ?> 
			</div>
		</div><!-- End tab content -->
	
    	</div> <!-- End of body panel -->
		</div> <!-- End of panel-->
                        <script>
$('#tab_video_view a').click(function (e) {
  e.preventDefault();
  $(this).tab('show');
})
</script>
        <?php
 }
 
 
   function truyen_render_view($id=''){?>
	  <div class="panel panel-info my-panel right-panel" id="<?php echo $id ?>">
 		 <div class="panel-heading">
    
            <ul class="nav nav-tabs mn_tab pull-left" >
            	<li><span class="head">Truyện</span></li>
       
			</ul>
             <ul class="nav nav-tabs mn_tab pull-right" id="tab_truyen_view">
        
          <li class="active li-list-cat-small"><a href="#ngay_truyen"><span class="label panel-label-small-title">Ngày</span></a></li>
          <li class="li-list-cat-small"><a href="#tuan_truyen"><span class="label panel-label-small-title">Tuần</span></a></li>
          <li class="li-list-cat-small"><a href="#thang_truyen"><span class="label panel-label-small-title">Tháng</span></a></li>
          <li class="li-list-cat-small"><a href="#nam_truyen"><span class="label panel-label-small-title">Năm</span></a></li>
		</ul>
		<div class="clearfix"></div>
         </div>
         
  		<div class="panel-body box_news">
  		
       
        <div class="tab-content mn_tab_content truyen_view">
            <div class="tab-pane active" id="ngay_truyen">
		 <?php   	echo get_truyen_view_day(); 	 ?> 
            </div> <!-- End tab 1 -->
          <div class="tab-pane" id="tuan_truyen">
          <?php   	echo get_truyen_view_week(); 	 ?> 
			</div>
          <div class="tab-pane" id="thang_truyen">
           <?php   	echo get_truyen_view_month(); 	 ?> 
			</div>
              <div class="tab-pane" id="nam_truyen">
           <?php   	echo get_truyen_view(); 	 ?> 
			</div>
		</div><!-- End tab content -->
	
    	</div> <!-- End of body panel -->
		</div> <!-- End of panel-->
                        <script>
$('#tab_truyen_view a').click(function (e) {
  e.preventDefault();
  $(this).tab('show');
})
</script>
        <?php
 }
 
/*  function render_donate(){
 echo '<ul class="list-group"> 
		<li class="list-group-item"> 
			<h1> Thành Viên Có Thể <span class="pull-right" style="color:#093"><i class="fa fa-chevron-down"></i></span></h1>
		</li> 
		<li class="list-group-item">Upload và chia sẻ truyện <span class="pull-right" style="color:#093"><i class="fa fa-chevron-down"></i></span></li>
		<li class="list-group-item">Chia sẻ Video Clip <span class="pull-right" style="color:#093"><i class="fa fa-chevron-down"></i></span></li>
		<li class="list-group-item"> Đăng Bài lên Blog <span class="pull-right" style="color:#093"><i class="fa fa-chevron-down"></i></span></li>
		<li class="list-group-item user_post_register"  style="text-align:center"><a class="btn btn-primary">Đăng Ký Up Bài <i class="fa fa-share"></i></a></li> </li>
	</ul>'; } */

function render_donate(){
	echo '<div id="donate_box">
				<p class="donate_box_title">Hãy đăng kí để upload và chia sẻ:</p>
										 		<p style="padding-left:10px;"><img src="'.HOME .'public/images/donate_icons.png" alt="Đăng kí upload tại mong.vn" /><a class="push-right button-register-upload user_post_register">Đăng kí</a><div style="clear: both;"></div></p>

			</div>';
}

 function render_fanpage(){
		if($_SESSION['mobile']==0){
		echo '	<div style="text-align:center"><input type="hidden" name="optionvalue" id="menu-search-box" class="input-medium" data-placeholder="Nhập Tên Truyện ..."   /></div><Br/>';
		// echo '<div class="panel panel-info ">  <div class="panel-body box_news"><div class="fb-like-box" data-href="'.FB_FANPAGE.'"  data-colorscheme="light" data-show-faces="true" data-header="false" data-stream="false" data-show-border="false"></div></div></div>';
		}
 }
 function render_user_box($data){
	 if($data['user']){
	  ?>
                    	 <div class="user_profile_wrap">
                    	
                                    <div class="row">
                                           
                                            <div class="col-md-12">
                                               <img src="<?php echo $data['user']['lavatar1']; ?>" class="img-circle img-responsive pull-left"  style="margin-right:15px; max-width:100px; max-height:100px" />
                              <div class="user_name" ><a href="<?php echo url_user($data['user']['username']) ?>"><?php echo $data['user']['show']; ?></a></div>
                             <div class="user_join">Tham gia : <?php echo time_ago($data['user']['date_registered']); ?></div>
                                              
                              <div class="user_static">
                            	<ul class="nav nav-pills">
                                  <li > <a href="<?php if($data['user']['contact_website']!=''){ echo $data['user']['contact_website'];}else{ echo url_user($data['user']['username']);} ?>" target="_blank" rel="nofollow"> <i class="fa fa-home"></i>   Website           </a>  </li>
                                  <li > <a href="<?php if($data['user']['facebook']==1){ echo "https://facebook.com/".$data['user']['facebook_id'];}else{ echo url()."#";} ?>" target="_blank" rel="nofollow"><i class="fa fa-facebook"></i> FaceBook </a> </li>
                               </ul>
                            </div>
                                            </div>
                                            <div class="clearfix"></div>
                                              <div class="user_description" style="color:#333; font-size:12px; margin-top:5px; color:#999"> <i class="fa fa-quote-left"></i>&nbsp; <?php echo $data['user']['gioithieu']; ?>&nbsp;<i class="fa fa-quote-right"></i></div>
                                    </div> <!-- End of row -->
                          
                         
                        <style>
                        .user_info span{ color:#999}
						.user_info span.label{ color:#fff}
                        </style>
                         <div class="row user_info">
                                       <div class="col-md-5">
                                    <div class="user_static">
                                        <ul class="nav nav-pills  nav-stacked">
                                          <li > <a href="<?php echo url_blog_user($data['user']['username']) ?>">       <span class="label label-default pull-right"><?php echo $data['user']['num']['blog']; ?></span>    BLOG           </a>  </li>
                                          <li > <a href="<?php echo url_video_user($data['user']['username']) ?>"><span class="label label-primary pull-right"><?php echo $data['user']['num']['video']; ?></span>VIDEO </a> </li>
                                             <li><a href="<?php echo url_truyen_user($data['user']['username']) ?>"> <span class="label label-success pull-right"><?php echo $data['user']['num']['truyen']; ?></span> TRUYỆN</a> </li>
                                         
                                        </ul>
                                    </div>
                            </div>
                            
                                  <div class="col-md-7">
                                    <div class="user_static">
                                        <ul class="nav nav-pills  nav-stacked">
                                          <li > <a href="<?php echo url(); ?>#" title="Nick Yahoo">       <span class="pull-right"><?php echo set_userinfo($data['user']['contact_yahoo']); ?></span>    <i class="fa fa-smile-o"></i>     </a>  </li>
                                          <li > <a href="<?php echo url(); ?>#" title="Skype"><span class="pull-right"><?php echo set_userinfo($data['user']['contact_skype']); ?></span><i class="fa fa-skype"></i> </a> </li>
                                             <li><a href="<?php echo url(); ?>#" title="Điện Thoại Di Động"> <span class="pull-right"><?php echo set_userinfo($data['user']['contact_phone']); ?></span> <i class="fa fa-phone"></i> </a> </li>       
                                                                         
                                        </ul>
                                    </div>
                            </div>
                            <div class="clearfix"></div>
                            <div class="col-md-12">
                            	<ul class="nav nav-pills  nav-stacked">
                                          
                                               <li><a href="<?php echo url(); ?>#" title="Địa chỉ email"> <span class="pull-right"><?php echo set_userinfo($data['user']['contact_email']); ?></span> <i class="fa fa-envelope-o"></i> Email</a> </li>
                                         
                                        </ul>
                            </div>
                         </div><!-- End row -->
                       
                    </div> <!-- End user detail wrap -->
                    <?php 
	 }
					} //End function get_user_box
					
function render_slide($data,$alias,$max){
?>

			<div class="clearfix"></div>
            <div style="height:15px"></div>
            <input type="hidden" id="<?php echo $alias; ?>-slider-total-page" name="<?php echo $alias; ?>-slider-total-page" value="<?php echo $max; ?>" />
	        <input type="hidden" id="<?php echo $alias; ?>-slider-current-page" name="<?php echo $alias; ?>-slider-current-page" value="1" />
  <a href="#" class="arrow_preview  btn-slider" style="display: block;" id="<?php echo $alias; ?>-btn-slider-prev" data-rel="<?php echo $alias; ?>"></a>
<a href="#" class="arrow_next  btn-slider" id="<?php echo $alias; ?>-btn-slider-next" data-rel="<?php echo $alias; ?>" style="display: block;"></a>

	<div  id="<?php echo $alias; ?>-wrapper" data-href="1">
  			<div class="wrap-loading" id="wrap-<?php echo $alias; ?>-loading" style="display: none;">
			<div class="loading" id="<?php echo $alias; ?>-loading"><img alt="loading" src="public/images/loading11.gif"></div><br>
			</div>
  			<div id="<?php echo $alias; ?>-content-slide-1" class="<?php echo $alias; ?>-content">

             	<?php render_item_truyen($data,1); ?>
  			</div> <!-- End of cucu content -->
            </div> <!-- End of decu wrapper -->
<?php }
 